package se.miun.dt156g.antonsskafferibestallning;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageButton;

public class GetOrderActivity extends Activity implements OnClickListener {

	@SuppressWarnings("deprecation")
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_get_order);
		
		Button table1 = (Button)findViewById(R.id.bTable1);
		table1.setOnClickListener(this);
		Button table2 = (Button)findViewById(R.id.bTable2);
		table2.setOnClickListener(this);
		Button table3 = (Button)findViewById(R.id.bTable3);
		table3.setOnClickListener(this);
		Button table4 = (Button)findViewById(R.id.bTable4);
		table4.setOnClickListener(this);
		Button table5 = (Button)findViewById(R.id.bTable5);
		table5.setOnClickListener(this);
		Button table6 = (Button)findViewById(R.id.bTable6);
		table6.setOnClickListener(this);
		Button table7 = (Button)findViewById(R.id.bTable7);
		table7.setOnClickListener(this);
		Button table8 = (Button)findViewById(R.id.bTable8);
		table8.setOnClickListener(this);
		Button table9 = (Button)findViewById(R.id.bTable9);
		table9.setOnClickListener(this);
		Button table10 = (Button)findViewById(R.id.bTable10);
		table10.setOnClickListener(this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.get_order, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		Intent startViewOrderActivity = new Intent(this, ViewOrderActivity.class);
		switch (v.getId()) {
			case R.id.bTable1:
				startViewOrderActivity.putExtra("TableNo", 1);
				break;
			case R.id.bTable2:
				startViewOrderActivity.putExtra("TableNo", 2);
				break;
			case R.id.bTable3:
				startViewOrderActivity.putExtra("TableNo", 3);
				break;
			case R.id.bTable4:
				startViewOrderActivity.putExtra("TableNo", 4);
				break;
			case R.id.bTable5:
				startViewOrderActivity.putExtra("TableNo", 5);
				break;
			case R.id.bTable6:
				startViewOrderActivity.putExtra("TableNo", 6);
				break;
			case R.id.bTable7:
				startViewOrderActivity.putExtra("TableNo", 7);
				break;
			case R.id.bTable8:
				startViewOrderActivity.putExtra("TableNo", 8);
				break;
			case R.id.bTable9:
				startViewOrderActivity.putExtra("TableNo", 9);
				break;
			case R.id.bTable10:
				startViewOrderActivity.putExtra("TableNo", 10);
				break;
			default:
				break;
		}
		startActivity(startViewOrderActivity);
		finish();
	}
}